<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${configure.packageName}.${generatorTable.moudleName}.dao.${generatorTable.fileDirName}.${generatorTable.upperClassName}Dao">
    <select id="getByParentId" resultType="${configure.packageName}.${generatorTable.moudleName}.model.${generatorTable.fileDirName}.${generatorTable.upperClassName}" >
        select *
        from
        ${generatorTable.tableName}
        where is_delete=0
        <if test="parentId != null"> and parent_id = ${'#'}{parentId} </if>
        <if test="parentId == null  or parentId == ''"> and parent_id = '0' </if>
        order by sort asc
    </select>

    <select id="chlidNum" resultType="int">
        select count(1)
        from
        ${generatorTable.tableName}
        where is_delete=0 and parent_id = ${'#'}{parentId}
    </select>

    <select id="listByIds"  resultType="${configure.packageName}.${generatorTable.moudleName}.model.${generatorTable.fileDirName}.${generatorTable.upperClassName}" >
        select *
        from
        ${generatorTable.tableName}
        where is_delete=0 and id in
        <foreach collection="ids" index="index" item="id" open="(" separator="," close=")">
            ${'#'}{id}
        </foreach>
    </select>

</mapper>
